package cn.edu.scau.cmi.linhongxin.singleton;

import java.util.ArrayList;
import java.util.List;

public class Marshal {
	private static List<Marshal> instance;
	private final static int num=10;
	private String name;
	private  Marshal(String name) {
		this.name=name;
	}
	public static boolean insert(String name) {
		if(instance==null) 
			instance=new ArrayList<>();
		if(instance.size()<num) {
			instance.add(new Marshal(name));
			return true;
		}
		return false;
	}
	public static List<Marshal> getInstances(){
		return instance;
	}
	@Override
	public String toString() {
		return name+""+getClass().getName()+'@'+hashCode()+"\n";
	}
}
